#include <aknutils.h> 

#include "HtmlDialog.h"

#define KDialogCustomControl  0x4000

SEikControlInfo CHtmlDialog::CreateCustomControlL(TInt /* aControlType*/)
{
	SEikControlInfo controlInfo;
	controlInfo.iFlags = EEikControlHasEars;
	controlInfo.iTrailerTextId = 0;
	iContainer = CHtmlControl::NewL(this);
	controlInfo.iControl = iContainer;

	return controlInfo;
}

void CHtmlDialog::ConstructLC(TInt aButtonResourceId, TInt aMenuResourceId)
{
	if(aMenuResourceId!=0)
		ConstructL(aMenuResourceId);
	
	if(aButtonResourceId==0)
		aButtonResourceId = R_AVKON_SOFTKEYS_BACK;
	
	//ConstructAutoDialogLC(EEikDialogFlagFillAppClientRect | EEikDialogFlagNoShadow | EEikDialogFlagNoBorder | EEikDialogFlagNoBackgroundFade | EEikDialogFlagWait |  EEikDialogFlagDontEatUpDownEvents | EEikDialogFlagNoDrag | EEikDialogFlagCbaButtons | EEikDialogFlagNotifyEsc,
	//		aButtonResourceId );

	ConstructAutoDialogLC( EEikDialogFlagNoShadow | EEikDialogFlagNoBorder | EEikDialogFlagNoBackgroundFade | EEikDialogFlagWait |  EEikDialogFlagDontEatUpDownEvents | EEikDialogFlagNoDrag | EEikDialogFlagCbaButtons | EEikDialogFlagNotifyEsc,
			aButtonResourceId );
	
	CreateLineByTypeL  (  KNullDesC,  KDialogCustomControl, KAknCtLastControlId, 0);
	
	AdjustControlRect();	
}

void CHtmlDialog::AdjustControlRect()
{
	TSize size;	
	//AknLayoutUtils::LayoutMetricsSize(AknLayoutUtils::EMainPane, size);
	//iContainer->SetRect(TRect(TPoint(0,0), size));
	iContainer->SetRect(TRect(0,0, 100, 100));
}

TBool CHtmlDialog::OkToExitL(TInt aButtonId)
{
	return CAknDialog::OkToExitL(aButtonId);
}

TKeyResponse CHtmlDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType )
{
	//if(aKeyEvent.iCode == EKeyDevice3 || aKeyEvent.iCode == EKeyEnter
	//	|| aKeyEvent.iScanCode == EStdKeyDevice3 || aKeyEvent.iScanCode == EStdKeyEnter) 
	//	iContainer->OfferKeyEventL(aKeyEvent, aType);
	//else
		//CAknDialog::OfferKeyEventL(aKeyEvent, aType);
	
	return EKeyWasConsumed;
}


